import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { HospitalVO, HospitalForm, HospitalQuery } from '@/api/system/hospital/types';

/**
 * 查询医院列表
 * @param query
 * @returns {*}
 */

export const listHospital = (query?: HospitalQuery): AxiosPromise<HospitalVO[]> => {
  return request({
    url: '/system/hospital/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询医院详细
 * @param id
 */
export const getHospital = (id: string | number): AxiosPromise<HospitalVO> => {
  return request({
    url: '/system/hospital/' + id,
    method: 'get'
  });
};

/**
 * 新增医院
 * @param data
 */
export const addHospital = (data: HospitalForm) => {
  return request({
    url: '/system/hospital',
    method: 'post',
    data: data
  });
};

/**
 * 修改医院
 * @param data
 */
export const updateHospital = (data: HospitalForm) => {
  return request({
    url: '/system/hospital',
    method: 'put',
    data: data
  });
};

/**
 * 删除医院
 * @param id
 */
export const delHospital = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/hospital/' + id,
    method: 'delete'
  });
};
